import Vue from 'vue'
import App from './App.vue'
import TypeNav from '@/components/TypeNav'
import Carsousel from '@/components/Carousel'
import Pagination from '@/components/Pagination'
import { Button, MessageBox } from 'element-ui';

// 引入路由
import router from '@/router'
//引入仓库
import store from '@/store';
//引入MockServe.js---mock数据
import '@/mock/mockServe'
//引入swiper样式
import "swiper/css/swiper.css"
//引入插件 懒加载
import VueLazyload from "vue-lazyload";
import atm from '@/assets/images/aoteman.gif'
//注册插件
Vue.use(VueLazyload, {
    //懒加载
    loading:atm
})
//统一接口api文件夹里面全部请求函数
//同意引入
import * as API from '@/api'
//第一个参数：全局组件的名字  第二个参数：哪一个组件
Vue.component(TypeNav.name, TypeNav)
Vue.component(Carsousel.name, Carsousel)
Vue.component(Pagination.name, Pagination)

Vue.component(Button.name, Button);
//ElementUI注册组件时 还有一种写法，挂载原型上
Vue.prototype.$msgbox = MessageBox;
Vue.prototype.$alert = MessageBox.alert;

Vue.config.productionTip = false


//引入自定义插件
import myPlugins from "@/plugins/myPlugins";
Vue.use(myPlugins,{
    name:'upper'
})

//引入校验插件
import "@/plugins/validate"
new Vue({
    render: h => h(App),
    //全局事件总线
    beforeCreate() {
        Vue.prototype.$bus = this;
        Vue.prototype.$API = API;
    },
    //注册路由：底下的写法KV一致省略V 小写
    //当书写router,组件身上都拥有$route $router
    router,
    //注册仓库：组件实例身上会多出一个$store的属性
    store
}).$mount('#app')
